Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui.lua): pcall prevents spectre from crashing on bad hl group #172

Conversation

Zeioth
Copy link
Contributor

@Zeioth Zeioth commented Oct 6, 2023

This is a hot-fix that prevent spectre from crashing when a hl group fail to be generated in some files

Pre-fix: spectre crashes

screenshot_2023-10-06_18-41-32_635825568

Post-fix: spectre fails gracefuly

screenshot_2023-10-06_18-41-13_102630000

More info

I've just added a pcall so it doesn't crash. But if someone has time and energy to go into this block of code and see what's going on, feel free. IDK if it's worth it as the only side effect of this issue is that some result rows will show broken colors in the files affected by this (which idk how often happens or why).

We can open an issue and further research it if you want.

@Zeioth Zeioth changed the title fix: Using a pcall prevents spectre from crashing if a hl group fail … fix: Using a pcall prevents spectre from crashing on bad hl group Oct 6, 2023
@Zeioth Zeioth changed the title fix: Using a pcall prevents spectre from crashing on bad hl group fix: pcall prevents spectre from crashing on bad hl group Oct 6, 2023
@Zeioth Zeioth changed the title fix: pcall prevents spectre from crashing on bad hl group fix(ui.lua): pcall prevents spectre from crashing on bad hl group Oct 6, 2023
@Zeioth Zeioth changed the title fix(ui.lua): pcall prevents spectre from crashing on bad hl group fix(ui.lua): pcall prevents spectre from crashing on bad hl group Oct 6, 2023
@Zeioth
Copy link
Contributor Author

Zeioth commented Oct 6, 2023

This is the file, in case someone wants to try to repro:

02-program-aliases

# PROGRAM VARIABLES
# ============================================================================

# File edition
$tui_file_browser = TERMCMD="foot -a 'scratchpad'" $term_scratch_standalone -T 'Ranger - File Manager' ranger
$gui_file_browser = thunar

$vim_editor  = $term -T 'VIM - Editor'  vim -S ~/.vim_runtime/temp_dirs/sessions/meta-editor.vim
$vim_backlog = $term -T 'VIM - Backlog' vim -S ~/.vim_runtime/temp_dirs/sessions/meta-backlogs.vim
$vim         = $term -T 'VIM - Editor'  vim

# No need no use sessions anymore, we have an automated session manager
$nvim         = $term -T 'NVIM - Editor'  nvim

# system aliases
$calc            = wofi-calc
$weather         = $term_scratch -T 'Weather'              weather
$backup_to_cloud = $term_scratch -T 'Backup to cloud'      ~/tweaks/sync-backup-to-cloud.sh
$update_packages = $term_scratch -T 'Updating packages...' update-packages
$update_mirrors  = $term_scratch -T "Updating mirrors..."  update-mirrors
$chatgpt         = $term_scratch -T "ChatGPT"              chatgpt
$lcg             = $term_scratch -T "Clg"                  clg
$help_keyboard   = $term_scratch -T 'CRKBD manual' nvim -m ~/workspaces/git-forks/keyboards/qmk_firmware/keyboards/crkbd/keymaps/zeioth_trackball_right/README.md
$help_nvim       = $term_scratch -T 'NVIM Manual' nvim -m ~/workspaces/git-forks/keyboards/qmk_firmware/keyboards/crkbd/keymaps/zeioth_trackball_right/VIM-MANUAL.md

# swayr aliases
$swayr-wintab    = env RUST_BACKTRACE=1 swayr switch-workspace-or-window >> /tmp/swayr.log 2>&1
$swayr-xkill     = env RUST_BACKTRACE=1 swayr quit-window -k > /tmp/swayr.log 2>&1
$swayr-next      = env RUST_BACKTRACE=1 swayr next-window >> /tmp/swayr.log 2>&2
$swayr-prev      = env RUST_BACKTRACE=1 swayr prev-window >> /tmp/swayr.log 2>&2
$swayrd          = env RUST_BACKTRACE=1 swayrd > /tmp/swayrd.log 2>&1"

# extra system utils
$corectrl = corectrl

@EpsilonKu
Copy link
Member

Ok, will look.

@EpsilonKu EpsilonKu merged commit 7cce250 into nvim-pack:master Nov 8, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants